import { Modal } from 'antd';
import React, { Fragment } from 'react';
import Title from '../../../indemnitySheet/components/Title/Title';
import AddPassenger from './components/AddPassenger';
import EditPassenger from './components/EditPassenger';
const PassengerListTable = props => {
  const {
    flightInfo,
    queryPassengerMaintenance,
    createModalVisible,
    handleModalVisible,
    handleTable,
    type,
    handelCheckedList,
    checkedPassengerList,
    orderId,
	passengerDataTable,
	handlePageSize,
	handleCurrent,
  handleTotal,
  segmentData,
  payType
  } = props;
  return (
    <Fragment>
      <Modal
        destroyOnClose={true}
        onCancel={() => {
          handleModalVisible(false);
        }}
        footer={null}
        width={'90%'}
        title={[<Title key="title" title={`${flightInfo.flightNo}航班旅客列表`} />]}
        visible={createModalVisible}
      >
        {type === 'examine' ? (
          <EditPassenger
            {...{ handleModalVisible, handelCheckedList, checkedPassengerList, orderId, payType }}
          />
        ) : (
          <AddPassenger
            {...{
              handelCheckedList,
              handleModalVisible,
              handleTable,
              passengerDataTable,
              checkedPassengerList,
              flightInfo,
              queryPassengerMaintenance,
              handlePageSize,
              handleCurrent,
              handleTotal,
              segmentData
            }}
          />
        )}
      </Modal>
    </Fragment>
  );
};

export default PassengerListTable;
